<?php
/**
 * Created by JiangJiaCai.
 * User: Administrator
 * Date: 2017/7/13 0013
 * Time: 10:48
 */

namespace ext\fun;


use ext\lib\SimpleRpc;

class EntityFun
{
    /**
     * RPC 内容存入实体
     * @param $entityName
     * @param RPC $rpc
     * @return object
     */
    public static function rpcPushEntity($entityName , SimpleRpc $rpc){
        $entity = new $entityName();
        $rpcArr = $rpc->toArray();
        foreach ($rpcArr as $k => $v){
            $entity->$k = $v;
        }
        return $entity;
    }
}